package com.huilian.iotbox.admin.service;

import com.github.pagehelper.PageInfo;
import com.huilian.iotbox.data.common.ServerResponse;
import com.huilian.iotbox.data.dto.OrderDto;
import com.huilian.iotbox.data.po.Order;
import com.huilian.iotbox.data.vo.OrderVo;
import org.apache.ibatis.annotations.Param;

import java.io.IOException;
import java.security.KeyManagementException;
import java.security.NoSuchAlgorithmException;
import java.security.NoSuchProviderException;
import java.util.List;


/**
 * @author lizhiquan
 * @CreateDate: 2021-04-02-15-33
 * @Description:
 */
public interface OrderService {

    PageInfo findOrderList(OrderDto orderDto);

    ServerResponse exportList(OrderDto orderDto);

    ServerResponse findOrderStatistics(OrderDto orderDto) throws Exception;

    /**
     * 统计当天的销售额,利润,交易笔数,销量(游戏币)
     *
     * @return
     */
    OrderVo findCountDay(OrderDto orderDto);

    /**
     * 根据时间查找订单
     *
     * @param startTime
     * @param endTime
     * @return
     */
    List<OrderVo> findDateOrder(@Param("agencyId") Integer agencyId, @Param("startTime") String startTime, @Param("endTime") String endTime);


    Integer updateStatusById(OrderDto order);

    OrderDto getById(Long orderId);

    Order findOldOrder(Long orderId);

    Integer delete(String endTime);


    /**
     * 查询支付成功的交易金额
     *
     * @param orderDto
     * @return
     */
    OrderVo findSuccessTotalAmount(OrderDto orderDto);

    Integer insert(OrderDto order);

    List<OrderVo> findSuccessTotalAmountList(OrderDto orderDto);

    /**
     * 新动态码支付（扭蛋机支付）
     *
     * @param subDeviceId
     * @param positionId
     * @param times
     * @param deviceNo
     * @return
     * @throws IOException
     */
    OrderDto intendpay(Integer subDeviceId, Integer positionId, Integer times, String deviceNo) throws IOException, NoSuchAlgorithmException, NoSuchProviderException, KeyManagementException;

    Order findOneOrderByCondition(Order condition);

    List<OrderVo> findDenominationCountByDeviceNo(OrderDto orderDenomination);

    List<OrderVo> findTurnoverOfflineGroupByDeviceNo(OrderDto orderDenomination);

    /**
     * 修改订单表数据, 抖音回调那边使用
     */
    Integer updateOrderDouYinData(OrderDto orderDto);

    /**
     * 根据id删除order表数据
     */
    Integer deleteOrderById(Long id);

    /**
     * 根据outTradeNo查询订单
     */
    OrderVo findOrderOneByOutTradeNo(String outTradeNo);

    OrderVo getOneOrderByDeviceNo(String deviceNo, Integer userId, Integer merchantStoreId);
}
